package app.Disthanitian.thaistyle.EmerMez;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.Toast;


public class AddContactEmail extends Activity{
  
	EditText contactmail ;
	String mail;
	MemberContact contact = new MemberContact();
	AddContactView1 data = new AddContactView1();
	
	protected void onCreate(Bundle saveInstanceState) {
		super.onCreate(saveInstanceState);
		setContentView(R.layout.addcontactemail);
		contactmail = (EditText) findViewById(R.id.ContactEmail);
	  
		actionBar();
	
		
	}
	
	public void actionBar() {

		ActionBar actionBar = getActionBar();
		actionBar.setDisplayHomeAsUpEnabled(true);
		actionBar.setTitle("Add Contact");

	}
	
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.addemail, menu);

		return true;
	}

	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		switch (item.getItemId()) {
		case R.id.action_ok:
		     ContactEmail();		 		      
			break;

			
		}
		return super.onOptionsItemSelected(item);
	}

	public void ContactEmail() {
		mail = contactmail.getText().toString().trim();
		contact.setContactEmail(mail);	
		Toast.makeText(AddContactEmail.this,contact.getContactEmail() + contact.getContactName()+contact.getContactPhone(), Toast.LENGTH_LONG).show();				
		//finishActivity(1);
	
		//data.DataContact(contact.getContactPhone(), contact.getContactEmail(), contact.getContactName());
		
		setResult(Activity.RESULT_OK);
	    finish();
		
	}
	
}
